<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\admin\controller;

/**
 * Description of Test
 *
 * @author Administrator
 */
class Test extends \think\Controller{
    //put your code here
    public function ajaxindex(){
        $model = new \app\admin\model\Goods;
        $pagesize = 1; //每页显示数据
        $page =(empty($_GET['p']))?1:$_GET['p'];  //当前页
        $count = $model->count();//总数量
        $start = ($page-1)*$pagesize; //开始位置 0,
        
        dump($count);
        $list = $model->limit($start,$pagesize)->select();
//        $list = db('goods')->select();
        dump($list);
        $total = ceil($count/$pagesize);
        
        $this->assign('page',$page);
        $this->assign('count',$count);
        $this->assign('list',$list);
        $this->assign('total',$total);


      return  $this->fetch();
        
    }
    
    
    
}
